import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/views/layout'
Vue.use(Router)
export const constantRoutes = [
  {
    path: '/layout',
    name: 'layout',
    // redirect: 'layout',//跳转的页面
    component: Layout,
  },
  {
    path: 'client',
    name: "client",
    component: () => import('@/views/client'),
  },
  {
    path: '/console',
    name: "console",
    component: () => import('@/views/console'),
  },
  {
    path: '*',
    redirect: '/layout',
  }

]



const createRouter = () => new Router({
  mode: 'hash', //history require service support
  base: '/',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})
const router = createRouter()
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}
export default router
